<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="net.sureon.dao.*"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="java.text.DecimalFormat"%>
<%@page import="net.sureon.common.DateFormat"%>
<%
	List<DailyTiming> all = null;
	all = (List<DailyTiming>) request.getAttribute("all");
%>
<%
int currentPage = (Integer)request.getAttribute("currentPage");
int pageCounter = (Integer)request.getAttribute("pageCounter");
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>下属的考勤</title>
		<script type="text/javascript">
			function submitReviewNote() {
				var reviewNote = document.getElementById("reviewNote").value;
				// alert(reviewNote);
				// document.dailyTimingForm.reviewNote.value = reviewNote;
				// alert(document.dailyTimingForm.reviewNote.value);
				
				document.getElementById("approved").href += reviewNote; 
			}
		</script>
	
	</head>
	<body>
		<jsp:include page="../header.jsp"></jsp:include>
		<div>
			<table cellpadding="0" cellspacing="0" class="style1">

				<tr>
					<td colspan="2">

						<table cellpadding="0" cellspacing="0" class="style5">
							<tr>
								<td style="text-align: left" bgcolor="#FFFBD6" class="style6">
									<table id="ctl00_ContentPlaceHolder1_Menu1"
										class="ctl00_ContentPlaceHolder1_Menu1_2" cellpadding="0"
										cellspacing="0" border="0">
										<tr>
											<td onmouseover="Menu_HoverStatic(this)"
													onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(this)"
													id="ctl00_ContentPlaceHolder1_Menu1n1">
													<table
														class="ctl00_ContentPlaceHolder1_Menu1_4 ctl00_ContentPlaceHolder1_Menu1_9"
														cellpadding="0" cellspacing="0" border="0" width="100%">
														<tr>
															<td style="white-space: nowrap;">
																<a
																	class="ctl00_ContentPlaceHolder1_Menu1_1 ctl00_ContentPlaceHolder1_Menu1_3 ctl00_ContentPlaceHolder1_Menu1_8"
																	href="<%=request.getContextPath() %>/user/underlingDailyTiming.do">待审批的考勤</a>
															</td>
														</tr>
													</table>
												</td>
											<td style="width: 3px;"></td>
											<td onmouseover="Menu_HoverStatic(this)"
												onmouseout="Menu_Unhover(this)" onkeyup="Menu_Key(this)"
												id="ctl00_ContentPlaceHolder1_Menu1n1">
												<table
													class="ctl00_ContentPlaceHolder1_Menu1_1 ctl00_ContentPlaceHolder1_Menu1_3"
													cellpadding="0" cellspacing="0" border="0" width="100%">
													<tr>
														<td style="white-space: nowrap;">
															<a
																class="ctl00_ContentPlaceHolder1_Menu1_1 ctl00_ContentPlaceHolder1_Menu1_3 ctl00_ContentPlaceHolder1_Menu1_8"
																href="<%=request.getContextPath() %>/user/underlingReviewDailyTiming.do">已审批的考勤</a>
														</td>
													</tr>
												</table>
											</td>
										</tr>
									</table>
								</td>
							</tr>
							<tr>
								<td style="text-align: left">

									<table cellpadding="0" cellspacing="0" class="style5">
										<tr>
											<td style="text-align: left">
												<div>
													<table cellspacing="0" cellpadding="4" border="0"
														id="ctl00_ContentPlaceHolder1_GridView1"
														style="color: #333333; font-family: Arial; font-size: Small; width: 100%; border-collapse: collapse;">
														<tr align="center"
															style="color: White; background-color: #507CD1; font-weight: bold;">
															<th scope="col" style="color: White;">
																姓名
															</th>
															<th scope="col" style="color: White;">
																日期
															</th>
															<th scope="col" style="color: White;">
																星期
															</th>
															<th scope="col" style="color: White;">
																工作时间
															</th>
															<th scope="col" style="color: White;">
																加班时间
															</th>
															<th scope="col" style="color: White;">
																休假时间
															</th>
															<th scope="col" style="color: White;">
																请假时间
															</th>
															<th scope="col" style="color: White;">
																工作内容/描述
															</th>
															<th scope="col" style="color: White;">
																提交时间
															</th>
															<th scope="col" style="color: White;" colspan=4> 
																&nbsp;&nbsp;
															</th>
														</tr>
													<%
														if (all == null || all.size() == 0) {
													%>
													<%
														} else {
															String bgColor=null;
															String color_a = "#FFFFFF";
															String color_b = "#EFF3FB";														
															for (int i = 0; i < all.size(); i++) {
																bgColor = (i%2 == 0)?color_a:color_b;
																DailyTiming dt = all.get(i);
														%>

														<tr align="center" style="background-color: <%=bgColor%>;">
															<td style="width: 75px;">
																<a href="<%=request.getContextPath() %>/user/underlingDailyTiming.do?showContent=true&dailyTimingID=<%=dt.getDailyTimingID() %>">	
																<%=dt.getAuthor().getRealName() %>
																</a>
															</td>
															<td style="width: 75px;">
																<%=DateFormat.formatToSimple(dt.getWorkDate()) %>
															</td>
															<td style="width: 75px;">
																<%=new SimpleDateFormat("E").format(dt.getWorkDate())%>
															</td>
															<td style="width: 60px;">
																<%=new DecimalFormat("####").format(dt.getWorkTime())%>
															</td>
															<td style="width: 60px;">
																<%=new DecimalFormat("####").format(dt.getOverTime())%>
															</td>
															<td style="width: 60px;">
																<%=new DecimalFormat("####").format(dt.getVocationTime())%>
															</td>
															<td style="width: 60px;">
																<%=new DecimalFormat("####").format(dt.getLeaveTime())%>
															</td>
															<td>
																<%
																						String note = dt.getWorkSummary();
																						if(note.length() > 73){
																							note = note.substring(0, 70);
																							note = note + "...";
																						}
																						out.print(note);
																%>						
															</td>
															<td style="width: 75px;">
																<%=DateFormat.formatToDetail(dt.getSubmitDate()) %>
															</td>
															<td style="width: 40px;">
																<a id="approved" href="<%=request.getContextPath() %>/user/confirmDailyTiming.do?dailyTimingID=<%=dt.getDailyTimingID() %>&reviewNote=" onclick="submitReviewNote();">批准</a>
															</td>
															<td style="width: 30px;">
																<a id="rejected" href="<%=request.getContextPath() %>/user/nonConfirmDailyTiming.do?dailyTimingID=<%=dt.getDailyTimingID() %>&reviewNote=" onclick="submitReviewNote();">驳回</a>
															</td>
														</tr>
														<%
																}
															}
														%>

													</table>
												</div>

											</td>
										</tr>

									</table>
								</td>
							</tr>
							
							<TR>
								<TD style="TEXT-ALIGN: center">
									<jsp:include page="../splitPage.jsp">
									<jsp:param name="url" value="/user/underlingDailyTiming.do"/>
									<jsp:param name="currentPage" value="<%=currentPage %>"/>
									<jsp:param name="pageCounter" value="<%=pageCounter %>"/>
									</jsp:include>
								</TD>
							</TR>						
							
							
							
		 <FORM id="dailyTimingForm" name="dailyTimingForm" action="<%=request.getContextPath()%>/user/underlingDailyTiming.do" method=post  onsubmit="return validateForm();">
				<TR>
					<TD style="TEXT-ALIGN: center" colSpan=5>
					<DIV id=ctl00_ContentPlaceHolder1_Panel1>
					<TABLE class=style5 cellSpacing=0 cellPadding=0>
						<TBODY>
						
						<%
								DailyTiming dt = (DailyTiming)request.getAttribute("dailyTiming");
									if(dt != null) {							
						 %>
								<TR>
								<TD style="TEXT-ALIGN: left"><SPAN
									id="yyyyyyyy" style="FONT-SIZE: small">考勤日期：</SPAN>
								<INPUT id="currentDate"
									style="FONT-SIZE: small; WIDTH: 86px; COLOR: #0000cc; HEIGHT: 16px"
									value="<%=new SimpleDateFormat("yyyy-MM-dd").format(dt.getWorkDate())%>"
									name="workdate" disabled="disabled"></TD>
								<TD style="TEXT-ALIGN: right"><SPAN
									id=ctl00_ContentPlaceHolder1_Label14 style="FONT-SIZE: small">工作时间：</SPAN>
								<INPUT id=ctl00_ContentPlaceHolder1_TextBox8
									style="FONT-SIZE: small; WIDTH: 30px; COLOR: #0000cc; HEIGHT: 16px"
									value=<%=dt.getWorkTime() %> name="workTime" /> <SPAN
									id=ctl00_ContentPlaceHolder1_Label15 style="FONT-SIZE: small">小时</SPAN>
								</TD>
								<TD style="TEXT-ALIGN: right"><SPAN
									id=ctl00_ContentPlaceHolder1_Label16 style="FONT-SIZE: small">加班时间：</SPAN>
								<INPUT id=ctl00_ContentPlaceHolder1_TextBox9
									style="FONT-SIZE: small; WIDTH: 30px; COLOR: #0000cc; HEIGHT: 16px"
									value=<%=dt.getOverTime() %> name="overTime" /> <SPAN
									id=ctl00_ContentPlaceHolder1_Label17 style="FONT-SIZE: small">小时</SPAN>
								</TD>
								<TD style="TEXT-ALIGN: right"><SPAN
									id=ctl00_ContentPlaceHolder1_Label18 style="FONT-SIZE: small">休假时间：</SPAN>
								<INPUT id=ctl00_ContentPlaceHolder1_TextBox10
									style="FONT-SIZE: small; WIDTH: 30px; COLOR: #0000cc; HEIGHT: 16px"
									value=<%=dt.getVocationTime() %> name="vocationTime" /> <SPAN
									id=ctl00_ContentPlaceHolder1_Label19 style="FONT-SIZE: small">小时</SPAN>
								</TD>
								<TD style="TEXT-ALIGN: right"><SPAN
									id=ctl00_ContentPlaceHolder1_Label20 style="FONT-SIZE: small">请假时间：</SPAN>
								<INPUT id=ctl00_ContentPlaceHolder1_TextBox11
									style="FONT-SIZE: small; WIDTH: 30px; COLOR: #0000cc; HEIGHT: 16px"
									value=<%=dt.getLeaveTime() %> name="leaveTime" /> <SPAN
									id=ctl00_ContentPlaceHolder1_Label21 style="FONT-SIZE: small">小时</SPAN>
									
									<input type="hidden" name="workDate" value="<%=new SimpleDateFormat("yyyy-MM-dd").format(dt.getWorkDate())%>" />
									<input type="hidden" name="edit" value="edit"/>
									<input type="hidden" name="dailyTimingID" value="<%=dt.getDailyTimingID() %>" />
								</TD>
							</TR>
							<TR>
								<TD colSpan=5><TEXTAREA
									id=ctl00_ContentPlaceHolder1_TextBox12
									style="WIDTH: 99.5%; COLOR: #0000cc; HEIGHT: 80px"
									name="workSummary"><%=dt.getWorkSummary() %></TEXTAREA></TD>
							</TR>
								
						<%		
								}
						 %>
						<%-- 
							<TR>
								<TD colSpan=5>
								
									<INPUT id=ctl00_ContentPlaceHolder1_Button2 type="submit" value="提 交" name="submit" onclick="return changeStatus('Pending')" />
									&nbsp; 
									<INPUT id=ctl00_ContentPlaceHolder1_Button1 type="submit" value="暂 存" name="save" onclick="return changeStatus('Saved')" /> 
									&nbsp; 
									<input type="hidden" name="status" value="" /> 
									
								</TD>
							</TR>
						--%>	
						</Form>
							
							
							
							
							
						</table>

					</td>
				</tr>
			</table>
		</div>
		<jsp:include page="../footer.jsp"></jsp:include>
	</body>
</html>
